<template>
    <div class="package-card" :class="{ 'selected': isSelected }" @click="selectPackage">
        <h3>{{ packageData.name }}</h3>
        <p>型号：{{ packageData.model }}</p>
        <p>平台价格：¥{{ packageData.price }}</p>
        <div v-if="!isSelected">
            <button @click.stop="selectPackage">选择</button>
        </div>
    </div>
</template>

<script>
export default {
    props: {
        packageData: {
            type: Object,
            required: true
        },
        isSelected: {
            type: Boolean,
            default: false
        }
    },
    methods: {
        selectPackage() {
            this.$emit('package-selected', this.packageData);
        }
    }
};
</script>

<style scoped>
.package-card {
    border: 1px solid #ccc;
    padding: 10px;
    margin: 10px;
    cursor: pointer;
    width: 200px;
    text-align: center;
}

.selected {
    border: 2px solid #007bff;
    background-color: #e6f2ff;
}
</style>